package structure.decorator.decorators.controller;

import structure.decorator.toBeDecorated.controller.Drink;

public abstract class Decorator extends Drink {
    Drink drink;    // 被装饰者

    public Decorator(Drink drink) {
        this.drink = drink;
    }

    @Override
    public float cost() {
        // 装饰者使用的价格 + 被装饰者的价格
        return super.getPrice() + drink.cost();
    }

    @Override
    public String getDes() {
        return super.getDes() + " " + super.getPrice()  // 装饰者
                + "==>" + drink.getDes();  // 被装饰者的信息
    }
}


